﻿using System;
using System.Collections.Generic;
using System.Data;
using MySql.Data.MySqlClient;
using System.Text;
using StandardDAC.Base;

namespace MySqlDAC {
    /// <summary>
    /// Specifies that property corresponds to SQL Server table column. (GET and SET required)
    /// </summary>
    public class MySqlColumn : DBColumn {
        /// <summary>
        /// Specifies name and type of column with the null value being "null".
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dbType"></param>
        public MySqlColumn(string name, MySqlDbType dbType)
            : base(name, dbType) {
        }
        /// <summary>
        /// Specifies name, null value, and type of column.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dbType"></param>
        /// <param name="nullValue"></param>
        public MySqlColumn(string name, MySqlDbType dbType, object nullValue)
            : base(name, dbType, nullValue) {
        }
        /// <summary>
        /// Specifies name, null value, and type of column. Also specifies whether column is part
        /// of the primary key for this table/class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dbType"></param>
        /// <param name="nullValue"></param>
        /// <param name="isPrimaryKey"></param>
        public MySqlColumn(string name, MySqlDbType dbType, object nullValue, bool isPrimaryKey)
            : base(name, dbType, nullValue, isPrimaryKey) {
        }
    }
    /// <summary>
    /// Specifies that property corresponds to SQL Server table column and that the column is a VarChar.
    /// (GET and SET required)
    /// </summary>
    public class StringMySqlColumn : MySqlColumn {
        /// <summary>
        /// Specifies name of VarChar column with the null value being "null" 
        /// </summary>
        /// <param name="name">column name</param>
        public StringMySqlColumn(string name) : base(name, MySqlDbType.VarChar) { }
        /// <summary>
        /// Specifies name and null value of the VarChar column
        /// </summary>
        /// <param name="name"></param>
        /// <param name="nullValue"></param>
        public StringMySqlColumn(string name, object nullValue) : base(name, MySqlDbType.VarChar, nullValue) { }
    }
    /// <summary>
    /// Specifies that property corresponds to SQL Server table column and that the column is a primary key
    /// for this table/class. (GET and SET required)
    /// </summary>
    public class PKMySqlColumn : MySqlColumn {
        /// <summary>
        /// Specifies name of Primary Key column with the null value being "null" and type being MySqlDbType.Int.
        /// </summary>
        /// <param name="name"></param>
        public PKMySqlColumn(string name) : base(name, MySqlDbType.Int32, null, true) { }
        /// <summary>
        /// Specifies name and null value of Primary Key column with type being MySqlDbType.Int.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="nullValue"></param>
        public PKMySqlColumn(string name, object nullValue) : base(name, MySqlDbType.Int32, nullValue, true) { }
        /// <summary>
        /// Specifies name, null value, and type of Primary Key column.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dbType"></param>
        /// <param name="nullValue"></param>
        public PKMySqlColumn(string name, MySqlDbType dbType, object nullValue) : base(name, dbType, nullValue, true) { }
    }
}
